#ifndef __COMPRESSOR_H__
#define __COMPRESSOR_H__

class Compressor
{
private:
	int PERIOD;
	unsigned int SAMPLE_RATE;

public:

  Compressor (float * efxoutl_, float * efxoutr_);
  ~Compressor ();

  void out (float * smps_l, float * smps_r);

  void Compressor_Change (int np, int value);
  void Compressor_Change_Preset (int npreset);
  int getpar (int npar);
  void cleanup ();

  float *efxoutl;
  float *efxoutr;



  // Compressor

  int tatt;			// attack time  (ms)
  int trel;			// release time (ms)
  int tratio;
  int toutput;
  int tthreshold;
  int a_out;
  int stereo;
  int tknee;

private:

  float rvolume;
  float lvolume;  
  float rvolume_db;
  float lvolume_db; 
  float thres_db;		// threshold
  float knee;
  float thres_mx;
  float kpct;			
  float ratio;			// ratio
  float kratio;			// ratio maximum for knee region
  float eratio;			// dynamic ratio
  float makeup;			// make-up gain
  float makeuplin;

  float outlevel;
  float att;
  float rel;
  
  float rgain;
  float rgain_old;

  float lgain;
  float lgain_old;

  float lgain_t;
  float rgain_t;

  float coeff_kratio;
  float coeff_ratio;
  float coeff_knee;
  float coeff_kk;               


public:
	bool SetSampleRate(unsigned int iSamplePerSec);
	bool SetBufferSize(int nSamples);
};

#endif